﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using PacManPP.Objects;

namespace PacManPP.Managers
{
    class ObjectManager
    {

        ContentManager content;
        SpriteBatch spriteBatch;

        List <IObject> gameObjects = new List<IObject>();

        List<PacMan> pacman = new List<PacMan>();
        List<Monster> monsters = new List<Monster>();
        List<Dot> dots = new List<Dot>();        
        List<Wall> walls = new List<Wall>();
        List<Fruit> fruits = new List<Fruit>();

        public ObjectManager()
        {


        }


        public ContentManager Content
        {
            get { return content; }
            set { content = value; }
        }

        public SpriteBatch SpriteBatch
        {
            get { return spriteBatch; }
            set { spriteBatch = value; }
        }


        public void LoadContent()
        {
           // monsters.Add(new Monster(MonsterColor.BLUE));
           // monsters.Add(new Monster(MonsterColor.PINK));
           // monsters.Add(new Monster(MonsterColor.RED));
           // monsters.Add(new Monster(MonsterColor.YELLOW));

            pacman.Add(new PacMan());

            gameObjects.AddRange(monsters);
            gameObjects.AddRange(pacman);

            foreach (IObject item in gameObjects)
            {
                item.SpriteBatch = spriteBatch;
                item.Content = content;
                item.LoadContent();
            }
        }

        public void Update(GameTime gameTime)
        {
            foreach (IObject item in gameObjects)
            {
                item.Update(gameTime);
            }
        }


        public void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();
            foreach (IObject item in gameObjects)
            {
                item.Draw(gameTime);
            }
            spriteBatch.End();

        }




    }
}
